package com.xxzx.publicprevention.service.impl;


import com.xxzx.publicprevention.mapper.GeoXzqxianDao;
import com.xxzx.publicprevention.pojo.GeoXzqxian;
import com.xxzx.publicprevention.service.GeoXzqxianService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeoXzqxian)表服务实现类
 *
 * @author makejava
 * @since 2020-11-10 08:05:15
 */
@Service("geoXzqxianService")
public class GeoXzqxianServiceImpl implements GeoXzqxianService {
    @Resource
    private GeoXzqxianDao geoXzqxianDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeoXzqxian queryById(Integer id) {
        return this.geoXzqxianDao.queryById(id);
    }

    @Override
    public List<GeoXzqxian> gis_Intersection(String coords) {
        return geoXzqxianDao.gis_Intersection(coords);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<GeoXzqxian> queryAllByLimit(int offset, int limit) {
        return this.geoXzqxianDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeoXzqxian> queryAll(GeoXzqxian geoXzqxian) {
        return geoXzqxianDao.queryAll(geoXzqxian);
    }

    /**
     * 新增数据
     *
     * @param geoXzqxian 实例对象
     * @return 实例对象
     */
    @Override
    public GeoXzqxian insert(GeoXzqxian geoXzqxian) {
        this.geoXzqxianDao.insert(geoXzqxian);
        return geoXzqxian;
    }

    /**
     * 修改数据
     *
     * @param geoXzqxian 实例对象
     * @return 实例对象
     */
    @Override
    public GeoXzqxian update(GeoXzqxian geoXzqxian) {
        this.geoXzqxianDao.update(geoXzqxian);
        return this.queryById(geoXzqxian.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geoXzqxianDao.deleteById(id) > 0;
    }
}
